package loginServer.thread;

import loginServer.controller.LoginServerController;
import net.socket.SocketConnection;
import net.socket.packet.SocketReceivablePacket;
import data.packetCode.UserPacketCode;

public class ConnectionReceivableThread implements Runnable
{
	private LoginServerController loginServerController;
	private SocketConnection socketConnection;
	private SocketReceivablePacket socketReceivablePacket;

	public ConnectionReceivableThread(LoginServerController loginServerController, SocketConnection socketConnection, SocketReceivablePacket socketReceivablePacket)
	{
		this.loginServerController=loginServerController;
		this.socketConnection=socketConnection;
		this.socketReceivablePacket=socketReceivablePacket;
	}

	@Override
	public void run()
	{
		readReceivablePacket();
	}

	private void readReceivablePacket()
	{
		switch(socketReceivablePacket.getPacketCode())
		{
		case UserPacketCode.USER_LOGIN:
			loginServerController.userLogin(socketConnection, socketReceivablePacket);
			break;
		}
	}
}
